Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QF-1414-Download and writing data to a temporary file in QFieldCloudProjects. #5905

Merged
merged 7 commits into from
Dec 30, 2024

Conversation

mohsenD98
Copy link
Collaborator

@mohsenD98 mohsenD98 commented Dec 20, 2024

PR Description:

This PR aims to handle the download progress of a network reply by writing the downloaded data incrementally to a temporary file. The key steps include:

  • Listening to Download Progress: We connect the downloadProgress signal of the NetworkReply to a lambda function that processes the download as it progresses.

  • File Writing: Inside the lambda, we open the temporary file in append mode (QIODevice::Append) and write the data to it each time new bytes are received.

  • Error Handling: If any error occurs while opening the file or during the write operation, we log the error and abort the network reply (rawReply->abort()).

  • Reading Data: For each progress update, we read all available data from the reply using readAll() and write it to the file.

Ui polish:

  1. Allow changing tabs ["My Projects" / "Community"].
  2. Fix invisible progressBar under headersection (layer name).
  3. Fix spacing between progressBar and next item.

Summary:

This approach focuses on incrementally saving downloaded data to a temporary file during each progress update. It includes basic error handling and attempts to append data to the file as it is received.

@mohsenD98 mohsenD98 self-assigned this Dec 20, 2024
@qfield-fairy
Copy link
Collaborator

qfield-fairy commented Dec 20, 2024

src/qml/QFieldCloudScreen.qml Show resolved Hide resolved
src/core/networkreply.cpp Show resolved Hide resolved
src/core/qfieldcloudprojectsmodel.cpp Outdated Show resolved Hide resolved
@mohsenD98 mohsenD98 changed the title WIP - Download and writing data to a temporary file in QFieldCloudProjects. Download and writing data to a temporary file in QFieldCloudProjects. Dec 21, 2024
src/core/networkreply.h Outdated Show resolved Hide resolved
@mohsenD98 mohsenD98 marked this pull request as ready for review December 27, 2024 14:45
Incrementally saving downloaded data to a temporary file during each progress update.
1- Allow changing tabs ["My Projects" / "Community"].
2- Fix invisible progressBar under headersection (layer name).
3- Fix spacing between progressBar and next item.
@mohsenD98 mohsenD98 force-pushed the QField-Cloud-Projects branch from abca708 to 74497ad Compare December 27, 2024 14:47
@nirvn
Copy link
Member

nirvn commented Dec 29, 2024

@suricactus , are you happy with this?

Copy link
Collaborator

@suricactus suricactus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good. Did not test. Thanks!

Linked to https://app.clickup.com/t/2192114/QF-1414

@mohsenD98 mohsenD98 changed the title Download and writing data to a temporary file in QFieldCloudProjects. QF-1414-Download and writing data to a temporary file in QFieldCloudProjects. Dec 29, 2024
@nirvn nirvn merged commit 23ca5bc into master Dec 30, 2024
24 checks passed
@nirvn nirvn deleted the QField-Cloud-Projects branch December 30, 2024 07:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants